package com.example.javabasic.thread.classone.demo1;

public class Test {
    private static final int max = 10;
    private int num =  1;
    public static void main(String[] args) {
        Context context = new Context(3,4);
        //添加算法一(用java8 lambda表达式)
        context.setAddData((a,b)->{
            return a+b;
        });
        System.out.println(context.conAdd());
        //添加算法二
        context.setAddData(new AddDataImpl());
        System.out.println(context.conAdd());
        //添加算法三
        Context context2 = new Context(5,6,(a,b)->{
            return  a*b;
        });
        System.out.println(context2.conAdd());

    }
}
